Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix dtype error in MHA layer/change dtype checking mechanism for manual cast #14791

Merged
merged 4 commits into from
Jan 29, 2024

Conversation

KohakuBlueleaf
Copy link
Collaborator

Description

torch.nn.MultiheadAttention have so much forks inside their forward call and is impossible to patch their inside call of computation operationg. I decide to give it "always fp32" when manual_cast is used.

And since the dtype error I got is weird, it claim the tensor it got is fp32 and fp8, which should never happen.(Should at least be fp32 and fp16)
So it is possible that torch_utils.get_param is not working for my case.

Based on some test, I finally decide to just go through all the parameters to check if there are any different dtype parameters.

Checklist:

@AUTOMATIC1111 AUTOMATIC1111 merged commit ce168ab into dev Jan 29, 2024
6 checks passed
@AUTOMATIC1111 AUTOMATIC1111 deleted the fix-mha-manual-cast branch January 29, 2024 17:39
@w-e-w w-e-w mentioned this pull request Feb 17, 2024
@pawel665j pawel665j mentioned this pull request Apr 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants